// 入驻申请
<template>
   <div class="search">
     <Row>
        <Card>
          <Row class="operation">
            <Form inline :label-width="100" ref="searchForm" :model="searchForm" label-position="right">
              <Button @click="getDataList()" icon="md-refresh">刷新</Button>
            </Form>
          </Row>
          <Modal title="查看大图" v-model="visible" class-name="fl-image-modal">
            <img :src="imgUrl" v-if="visible" style="width: 100%">
          </Modal>

          <Row>
            <Table :loading="loading" border :columns="columns" :data="data" ref="table" sortable="custom" @on-sort-change="changeSort"></Table>
          </Row>

          <Row type="flex" justify="end" class="page">
            <Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10,20,50]" size="small" show-total show-elevator show-sizer></Page>
          </Row>

         </Card>
     </Row>
   </div> 
</template>

<script>
export default {
  data(){
    return{ 
      total:0,
      loading: true, // 表单加载状态
      data:[],//表单数据
      searchForm:{
        pageSize:10,
        pageNumber:1
      },
      columns: [
      // 表头
      {
        type: "index",
        width: 60,
        align: "center"
      },
      {
        title: "用户名称",
        key: "userName",
        minWidth: 120,
        sortable: false,
      },
      {
        title: "联系方式",
        key: "mobile",
        minWidth: 120,
        sortable: false,
      },
      {
        title: "建议内容",
        key: "feedback",
        minWidth: 120,
        sortable: false,
      },
      {
        title: "创建时间",
        key: "createTime",
        minWidth: 120,
        sortable: false,
      },
      ]}
    },
    methods:{
      init(){
        this.getDataList()
      },
      getDataList(){
        this.loading = true;
        this.postRequest("/userFeedback/getFeedbackList",this.searchForm).then(res =>{
          this.loading = false
          if(res.success){
            var arr = res.result.data;
            for(let val of arr){
              for(let i in val){
                (val[i] === null) ? (val[i] = "-") : ""
              }
            }  
            this.data = res.result.data;
            this.total = res.result.size;
          } else {
            this.data = [];
            this.total = 0;
          }
        })
      },
      changeSort(e) {
        this.searchForm.sort = e.key;
        this.searchForm.order = e.order;
        if (e.order === "normal") {
          this.searchForm.order = "";
        }
        this.getDataList();
      },
      changePage(v) {
        this.searchForm.pageNumber = v;
        this.getDataList();
      },
      changePageSize(v) {
        this.searchForm.pageSize = v;
        this.getDataList();
      },
      clearSelectAll(){
        this.$refs.searchForm.resetFields()
        this.getDataList()
      },
    },
    mounted(){
        this.init()
    }
}
</script>

<style lang="less">
.search {
    .operation {
        margin-bottom: 2vh;
    }
    .select-count {
        font-size: 13px;
        font-weight: 600;  
        color: #40a9ff;
    }
    .select-clear {
        margin-left: 10px;
    }
    .page {
        margin-top: 2vh;
    }
    .drop-down {
        font-size: 13px;
        margin-left: 5px;
    }
}
</style>